﻿#region Librerias

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

#endregion


namespace ESF.General.Entity
{	
	public class BaseEnterprise : BasicReference, IEnterprise
	{
		public string Email { set; get; }

		public string IdentificationNumber { set; get; }

		public string IdentificationVerificationDigit { set; get; }

		public BasicReference IdentificationType { set; get; }

		public BasicReference Type { set; get; }

		public string LegalRepresentative { set; get; }


		#region Funciones

		public override string ToString()
		{
			StringBuilder result = new StringBuilder ();


			if (IdentificationType != null && !string.IsNullOrWhiteSpace (IdentificationNumber))
			{
				result.Append (IdentificationType.Code);
				result.Append("-");
				result.Append (IdentificationNumber);

				if (!string.IsNullOrWhiteSpace (IdentificationVerificationDigit))
				{
					result.Append (" " + IdentificationVerificationDigit);
				}
			}

			if (!string.IsNullOrWhiteSpace (Name))
			{
				result.Append (" ");
				result.Append (Name);
			}
			
			if (!string.IsNullOrWhiteSpace(Email))
			{
				result.Append(" ");
				result.Append(Email);
			}

			return result.ToString ();
		}

		#endregion
	}
}
